home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 3 / ct-rom iiib.zip / ct-rom iiib / WINDOWS / DIVERSEN / WINE02BX / HIDEIF.ELC < prev    next >
Text File  |  1993-03-28  |  17KB  |  188 lines

  1. ;;; compiled by @win386 on Sat Mar 13 14:31:33 1993
  2. ;;; from file c:/src/lucid-19.4/lisp/modes/hideif.el
  3. ;;; emacs version 19.3 Lucid.
  4. ;;; bytecomp version 2.08; 27-aug-92.
  5. ;;; optimization is on.
  6. ;;; this file uses opcodes which do not exist in Emacs18.
  7.  
  8. (if (and (boundp 'emacs-version)
  9.      (or (and (boundp 'epoch::version) epoch::version)
  10.          (string-lessp emacs-version "19")))
  11.     (error "This file was compiled for Emacs19."))
  12.  
  13. (defvar hide-ifdef-mode-map nil "\
  14. Keymap used with hide-ifdef mode")
  15. (defconst hide-ifdef-mode-prefix-key "" "\
  16. Prefix key for all hide-ifdef-mode commands.")
  17. (defvar hide-ifdef-mode-map-before nil "\
  18. Buffer-local variable to store a copy of the local keymap
  19.     before hide-ifdef-mode modifies it.")
  20. (fset 'define-hide-ifdef-mode-map #[nil "¼τ┴ ┬├─#ê┬┼╞#ê┬╟╚#ê┬╔╩#ê┬╦╠#ê┬═╬#ê┬╧╨#ê┬╤╥#ê┬╙╘#ê┬╒╓#ê┬╫╪#ê┬┘┌#ê┬█▄#ê┬▌▐#ê┬▀α#ê┬ßΓπΣ#σ#ê└Mç" [hide-ifdef-mode-map make-sparse-keymap define-key "d" hide-ifdef-define "u" hide-ifdef-undef "D" hide-ifdef-set-define-alist "U" hide-ifdef-use-define-alist "h" hide-ifdefs "s" show-ifdefs "" hide-ifdef-block "" show-ifdef-block "" forward-ifdef "" backward-ifdef "" down-ifdef "" up-ifdef "" next-ifdef "" previous-ifdef "" hide-ifdef-toggle-read-only where-is-internal toggle-read-only nil t hide-ifdef-toggle-outside-read-only] 6])
  21. (fset 'hif-update-mode-line #[nil "└┴ !ç" [set-buffer-modified-p buffer-modified-p] 2 "\
  22. Update mode-line by setting buffer-modified to itself."])
  23. (defvar hide-ifdef-mode nil "\
  24. non-nil when hide-ifdef-mode is activated.")
  25. (defvar hide-ifdef-hiding nil "\
  26. non-nil when text may be hidden.")
  27. (byte-code "└    ₧¼ä┬    B├    ₧¼ä─    B└ç" [hide-ifdef-hiding minor-mode-alist (hide-ifdef-hiding " Hiding") hide-ifdef-mode (hide-ifdef-mode " Ifdef")] 2)
  28. (fset 'hide-ifdef-mode #[(arg) "└┴!ê\n¼ä    ?¬à├\n!─V┼ ê    ½┌╞╟╚\"ê╞╔╩\"ê╞╦╩\"ê└╠!ê═╠! └╬!ê═╬!└╧!ê└╤!ê╥ ╙╘╥ !!ê╒!ê╫╪\"ê┘ ê┌█!ê½à▌ ê¬â▐ ê▀α!ç½â▐ ê╙!ê▀ß!ç" [make-local-variable hide-ifdef-mode arg prefix-numeric-value 0 hif-update-mode-line modify-syntax-entry 95 "w" 38 "." 124 hide-ifdef-env default-value hide-ifdef-hiding hif-outside-read-only buffer-read-only hide-ifdef-mode-map-before current-local-map use-local-map copy-keymap local-unset-key hide-ifdef-mode-prefix-key local-set-key hide-ifdef-mode-map define-hide-ifdef-mode-map run-hooks hide-ifdef-mode-hook hide-ifdef-initially hide-ifdefs show-ifdefs message "Enter hide-ifdef-mode." "Exit hide-ifdef-mode."] 3 "\
  29. Toggle hide-ifdef-mode.  Thus this is a minor mode, albeit a large one.
  30. With arg, turn hide-ifdef-mode on iff arg is positive.
  31. In hide-ifdef-mode, code within #ifdef constructs that the C preprocessor
  32. would eliminate may be hidden from view.  Several variables affect
  33. how the hiding is done:
  34.  
  35. hide-ifdef-env
  36.     An association list of defined and undefined symbols for the
  37.     current buffer.  Initially, the global value of hide-ifdef-env is used.
  38.  
  39. hide-ifdef-define-alist
  40.     An association list of defined symbol lists.  
  41.         Use hide-ifdef-set-define-alist to save the current hide-ifdef-env
  42.         and hide-ifdef-use-define-alist to set the current hide-ifdef-env
  43.         from one of the lists in hide-ifdef-define-alist.
  44.  
  45. hide-ifdef-lines
  46.     Set to non-nil to not show #if, #ifdef, #ifndef, #else, and
  47.     #endif lines when hiding.
  48.  
  49. hide-ifdef-initially
  50.     Indicates whether hide-ifdefs should be called when hide-ifdef-mode
  51.     is activated.
  52.  
  53. hide-ifdef-read-only
  54.     Set to non-nil if you want to make buffers read only while hiding.
  55.     After show-ifdefs, read-only status is restored to previous value.
  56.  
  57. \\{hide-ifdef-mode-map}" "P"])
  58. (fset 'hif-outline-flag-region #[(from to flag) "└ ┬Ä├ ╟U½â╚¬ü╟╔%*ç" [buffer-modified-p modp ((set-buffer-modified-p modp)) subst-char-in-region from to flag 10 13 t] 6 "\
  59. Hides or shows lines from FROM to TO, according to FLAG.  If FLAG
  60. is \\n (newline character) then text is shown, while if FLAG is \\^M
  61. (control-M) the text is hidden."])
  62. (fset 'hif-show-all #[nil "└ed┴#ç" [hif-outline-flag-region 10] 4 "\
  63. Show all of the text in the current buffer." nil])
  64. (fset 'hide-ifdef-region #[(start end) "└    \n├#ç" [hif-outline-flag-region start end 13] 4 "\
  65. START is the start of a #if or #else form.  END is the ending part.
  66. Everything including these lines is made invisible."])
  67. (fset 'hif-show-ifdef-region #[(start end) "└    \n├#ç" [hif-outline-flag-region start end 10] 4 "\
  68. Everything between START and END is made visible."])
  69. (defvar hide-ifdef-evaluator 'eval "\
  70. The evaluator is given a canonical form and returns T if text under
  71. that form should be displayed.")
  72. (defvar hif-undefined-symbol nil "\
  73. ...is by default considered to be false.")
  74. (defvar hide-ifdef-env nil "\
  75. An alist of defined symbols and their values.")
  76. (fset 'hif-set-var #[(var value) "    B\nBëç" [var value hide-ifdef-env] 2 "\
  77. Prepend (var value) pair to hide-ifdef-env."])
  78. (byte-code "└┴Mê┬├Mê──╞P╚P    ╩P ╠P    ╬ ╬░└ç" [hif-lookup #[(var) "└    \n\"ë½ä A¬ü )ç" [assoc var hide-ifdef-env val hif-undefined-symbol] 4] hif-defined #[(var) "└    !ç" [hif-lookup var] 2] "\\(^\\|\\)[     ]*#[     ]*" hif-cpp-prefix "ifndef" hif-ifndef-regexp "if\\(n?def\\)?[     ]+" hif-ifx-regexp "else" hif-else-regexp "endif" hif-endif-regexp "\\|" hif-ifx-else-endif-regexp] 5)
  79. (fset 'hif-infix-to-prefix #[(token-list) "G┴U½ç┬├@DDç─!ç" [token-list 1 hif-lookup quote hif-parse-if-exp] 3 "\
  80. Convert list of tokens in infix into prefix list"])
  81. (byte-code "└┬─ç" ["^\\(!\\|&&\\|||\\|[()]\\|\\w+\\)" hif-token-regexp "\\*/" hif-end-of-comment nil] 1)
  82. (fset 'hif-tokenize #[(expr-string) "└┴\nG Wâ⌐╞╟\n #½ï┴ò\n S╚Iê¬h╞╔\n #½ó┴ò\n S╚Iê╞\n\n #¼å╞╦\n #ê┴ò\n S╚Iê¬?╞ \n #½╤\n ┴òO┴ò\n S╚Iê╬ÿ½â╧¬▒╨ÿ½â╤¬¿╥ÿ½â╙¬ƒ╘ÿ½â╒¬û╓ÿ½â╫¬ì╪ÿ½â┘¬ä┌!B)é█▄\n\"êéƒ+ç" [nil 0 expr-string expr-length expr-start token-list string-match "^[     ]+" 10 "^/\\*" hif-end-of-comment "$" hif-token-regexp token "||" or "&&" and "!" not "defined" hif-defined "(" lparen ")" rparen intern error "Bad #if expression: %s"] 4 "\
  83. Separate string into a list of tokens"])
  84. (fset 'hif-parse-if-exp #[(token-list) "└ ê┴ \n½à├─\n\"êç" [hif-nexttoken hif-expr token error "Error: unexpected token: %s"] 4 "\
  85. Parse the TOKEN-LIST.  Return translated list in prefix form."])
  86. (fset 'hif-nexttoken #[nil "@A    ç" [token-list token] 1 "\
  87. Pop the next token from token-list into the let variable \"token\"."])
  88. (fset 'hif-expr #[nil "└ \n├=½ï─ ê├    └ E¬p    )ç" [hif-term result token or hif-nexttoken] 3 "\
  89. Parse and expression of the form
  90.        expr : term | expr '||' term."])
  91. (fset 'hif-term #[nil "└ \n├=½ï─ ê├    └ E¬p    )ç" [hif-factor result token and hif-nexttoken] 3 "\
  92. Parse a term of the form
  93.        term : factor | term '&&' factor."])
  94. (fset 'hif-factor #[nil "┴=½ê┬ ê┴├ Dç─=½Ö┬ ê┼ ╟=¼å╚╔\"¬à┬ ê)ç╩=½│┬ ê─=¼ä╚╦!ê┬ ê ═>½à╚╬\"ê┬ ê╟=¼ä╚╧!ê┬ ê╩╨ )DDçë ╤>½ä╚╥!ê┬ ê╙╨ )DDç" [token not hif-nexttoken hif-factor lparen hif-expr result rparen error "Bad token in parenthesized expression: %s" hif-defined "Error: expected \"(\" after \"defined\"" ident (or and not hif-defined lparen rparen) "Error: unexpected token: %s" "Error: expected \")\" after identifier" quote (or and) "Error: missing identifier" hif-lookup] 4 "\
  95. Parse a factor of the form
  96.        factor : '!' factor | '(' expr ')' | 'defined(' id ')' | id."])
  97. (fset 'hif-canonicalize #[nil "è└    !├ !ê`┼╞wê`{╚╔!!\n\n½å╦\nD¬é\n,ç" [looking-at hif-ifndef-regexp negate re-search-forward hif-ifx-regexp "^\n" nil expr-string hif-infix-to-prefix hif-tokenize expr not] 3 "\
  98. When at beginning of #ifX, returns a canonical (evaluatable)
  99.        form for the expression."])
  100. (fset 'hif-find-any-ifX #[nil "└    d┬#├yêç" [re-search-forward hif-ifx-regexp t 0] 4 "\
  101. Position at beginning of next #if, #ifdef, or #ifndef, including one on
  102. this line."])
  103. (fset 'hif-find-next-relevant #[nil "└ê┴\nd├#¡ä─yê└ç" [nil re-search-forward hif-ifx-else-endif-regexp t 0] 4 "\
  104. Position at beginning of next #ifdef, #ifndef, #else, #endif,
  105. NOT including one on this line."])
  106. (fset 'hif-find-previous-relevant #[nil "└yê┴\ne├#¡ä└yê─ç" [0 re-search-backward hif-ifx-else-endif-regexp t nil] 4 "\
  107. Position at beginning of previous #ifdef, #ifndef, #else, #endif,
  108. NOT including one on this line."])
  109. (byte-code "└┴Mê┬├Mê─┼Mç" [hif-looking-at-ifX #[nil "└    !ç" [looking-at hif-ifx-regexp] 2] hif-looking-at-endif #[nil "└    !ç" [looking-at hif-endif-regexp] 2] hif-looking-at-else #[nil "└    !ç" [looking-at hif-else-regexp] 2]] 2)
  110. (fset 'hif-ifdef-to-endif #[nil "└ ê┴ ½å┬ ê┬ ç├ ½â┬ ç─ ½é┼ç╞╟!ç" [hif-find-next-relevant hif-looking-at-ifX hif-ifdef-to-endif hif-looking-at-else hif-looking-at-endif done error "Missmatched #ifdef #endif pair"] 2 "\
  111. If positioned at #ifX or #else form, skip to corresponding #endif."])
  112. (fset 'hif-endif-to-ifdef #[nil "`┴ ê`U½ä┬├!ê)─ ½å┼ ê┼ ç╞ ½â┼ ç╟ ½é╚ç╔ç" [start hif-find-previous-relevant error "Missmatched #ifdef #endif pair" hif-looking-at-endif hif-endif-to-ifdef hif-looking-at-else hif-looking-at-ifX done t] 2 "\
  113. If positioned at #endif form, skip backward to corresponding #ifX."])
  114. (fset 'forward-ifdef #[(&optional arg) "¼é┴┬W½à├[!ê┬W¡ƒ[`┼ ¼â╞ ê┼ ½à╟ ê¬ç bê╚╔!ê)¬\\ç" [arg 1 0 backward-ifdef start hif-looking-at-ifX hif-find-next-relevant hif-ifdef-to-endif error "No following #ifdef"] 2 "\
  115. Move point to beginning of line of the next ifdef-endif.
  116.        With argument, do this that many times." "p"])
  117. (fset 'backward-ifdef #[(&optional arg) "¼é┴┬W½à├[!ê┬W¡óS┬yê`┼ ¼â╞ ê┼ ½à╟ ê¬ç bê╚╔!ê)¬Yç" [arg 1 0 forward-ifdef start hif-looking-at-endif hif-find-previous-relevant hif-endif-to-ifdef error "No previous #ifdef"] 2 "\
  118. Move point to beginning of the previous ifdef-endif.
  119.        With argument, do this that many times." "p"])
  120. (fset 'down-ifdef #[nil "`┴ ê┬ «é├ ?¡åbê─┼!)ç" [start hif-find-next-relevant hif-looking-at-ifX hif-looking-at-else error "No following #ifdef"] 2 "\
  121. Move point to beginning of nested ifdef or else-part." nil])
  122. (fset 'up-ifdef #[nil "└yê`┬ ¼â├ ê┬ ½â─ ê    `U¡â┼╞!)ç" [0 start hif-looking-at-endif hif-find-previous-relevant hif-endif-to-ifdef error "No previous #ifdef"] 2 "\
  123. Move point to beginning of enclosing ifdef or else-part." nil])
  124. (fset 'next-ifdef #[(&optional arg) "¼é┴┬W½à├[!ê┬W¡ÆS─ êl½r┬yê┼╞!ê¬iç" [arg 1 0 previous-ifdef hif-find-next-relevant error "No following #ifdefs, #elses, or #endifs"] 2 "\
  125. Move to the beginning of the next #ifX, #else, or #endif.
  126.        With argument, do this that many times." "p"])
  127. (fset 'previous-ifdef #[(&optional arg) "¼é┴┬W½à├[!ê┬W¡öS`┼ ê `U½ä╞╟!ê)¬gç" [arg 1 0 next-ifdef start hif-find-previous-relevant error "No previous #ifdefs, #elses, or #endifs"] 2 "\
  128. Move to the beginning of the previous #ifX, #else, or #endif.
  129.        With argument, do this that many times." "p"])
  130. (byte-code "└┴Mê┬├Mê─┼Mê╞╟Mê╚╔Mç" [hif-make-range #[(else-p start end &optional else) "    \n Fç" [else-p start else end] 4] hif-range-else-p #[(range) "┴£ç" [range 0] 2] hif-range-start #[(range) "┴£ç" [range 1] 2] hif-range-else #[(range) "┴£ç" [range 2] 2] hif-range-end #[(range) "┴£ç" [range 3] 2]] 2)
  131. (fset 'hif-find-range #[nil "è└yê`┴ëë╞ ê╟ ½ê╚ ê╞ ê¬t╔ ½å╩`¬é` ½Ö╞ ê╟ ½ê╚ ê╞ ê¬t╔ ½ä╦╠!ê`═ \n $-ç" [0 nil end else else-p start hif-find-next-relevant hif-looking-at-ifX hif-ifdef-to-endif hif-looking-at-else t error "Found two elses in a row?  Broken!" hif-make-range] 5 "\
  132. Returns a Range structure describing the current #if region.
  133. Point is left unchanged."])
  134. (fset 'hif-hide-line #[(point) "¡ÿè    bê┬ ─Ä┼yê`╞U?¡à╟`S`\"+ç" [hide-ifdef-lines point buffer-modified-p modp ((set-buffer-modified-p modp)) 0 1 hide-ifdef-region] 3 "\
  135. Hide the line containing point.  Does nothing if
  136. hide-ifdef-lines is nil."])
  137. (fset 'hif-recurse-on #[(start end) "èîbê┴ê`\n}ê├ *ç" [start nil end hide-ifdef-guts] 2 "\
  138. Call hide-ifdef-guts after narrowing to end of START line and END
  139. line."])
  140. (fset 'hif-possibly-hide #[nil "└ ┴ ─┼\n!!ê !½½╟\n!½¢─╚\n!!ê╔╚\n!┼\n!S\"ê╩╦\n!╚\n!\"ê¬│╩╦\n!┼\n!\"ꬿ╟\n!½¢─╚\n!!ê╔╦\n!╚\n!S\"ê╩╚\n!┼\n!\"ê¬ê╔`┼\n!S\"ê─╦\n!!ê┼\n!bê╠*ç" [hif-canonicalize hif-find-range range test hif-hide-line hif-range-end hide-ifdef-evaluator hif-range-else-p hif-range-else hide-ifdef-region hif-recurse-on hif-range-start nil] 4 "\
  141. Called at #ifX expression, this hides those parts that should be
  142. hidden, according to judgement of hide-ifdef-evaluator."])
  143. (fset 'hide-ifdef-guts #[nil "èebê└ ¡à┴ ê¬w)ç" [hif-find-any-ifX hif-possibly-hide] 1 "\
  144. Does the work of hide-ifdefs, except for the work that's pointless
  145. to redo on a recursive entry."])
  146. (defvar hide-ifdef-initially nil "\
  147. *Non-nil if hide-ifdefs should be called when hide-ifdef-mode
  148.     is first activated.")
  149. (defvar hide-ifdef-hiding nil "\
  150. Non-nil if text might be hidden.")
  151. (defvar hide-ifdef-read-only nil "\
  152. *Set to non-nil if you want buffer to be read-only while hiding text.")
  153. (defvar hif-outside-read-only nil "\
  154. Internal variable.  Saves the value of buffer-read-only while hiding.")
  155. (defvar hide-ifdef-lines nil "\
  156. *Set to t if you don't want to see the #ifX, #else, and #endif lines.")
  157. (fset 'hide-ifdef-toggle-read-only #[nil "?┴┬½â├¬ü─\"ê½ç«é╚ ç" [hide-ifdef-read-only message "Hide-Read-Only %s" "ON" "OFF" hide-ifdef-hiding hif-outside-read-only buffer-read-only hif-update-mode-line] 3 "\
  158. Toggle hide-ifdef-read-only." nil])
  159. (fset 'hide-ifdef-toggle-outside-read-only #[nil "?┴┬½â├¬ü─\"ê½ä«ü╚ ç" [hif-outside-read-only message "Read only %s" "ON" "OFF" hide-ifdef-hiding hide-ifdef-read-only buffer-read-only hif-update-mode-line] 3 "\
  160. Replacement for toggle-read-only within hide-ifdef-mode." nil])
  161. (fset 'hide-ifdef-define #[(var) "└    ┬\"ê ¡é─ ç" [hif-set-var var t hide-ifdef-hiding hide-ifdefs] 3 "\
  162. Define a VAR so that #ifdef VAR would be included." "SDefine what? "])
  163. (fset 'hide-ifdef-undef #[(var) "└    ┬\"ê ¡é─ ç" [hif-set-var var nil hide-ifdef-hiding hide-ifdefs] 3 "\
  164. Undefine a VAR so that #ifdef VAR would not be included." "SUndefine what? "])
  165. (fset 'hide-ifdefs #[nil "└┴!ê\n¼ä┬├!ê ½â┼ ê½â╟ ê╚    ╚╩ ê ¼ä ½â╟ ê└═!ç" [message "Hiding..." hide-ifdef-mode 1 hide-ifdef-hiding show-ifdefs buffer-read-only toggle-read-only t selective-display hide-ifdef-guts hide-ifdef-read-only hif-outside-read-only "Hiding done"] 2 "\
  166. Hide the contents of some #ifdefs.  Assume that defined symbols have
  167. been added to hide-ifdef-env.  The text hidden is the text that would not
  168. be included by the C preprocessor if it were given the file with those
  169. symbols defined.
  170.  
  171. Turn off hiding by calling show-ifdef." nil])
  172. (fset 'show-ifdefs #[nil "½â┴ ê┬─ ê½â┴ ê┬ëç" [buffer-read-only toggle-read-only nil selective-display hif-show-all hif-outside-read-only hide-ifdef-hiding] 2 "\
  173. Cancel the effects of hide-ifdef.  The contents of all #ifdefs is shown." nil])
  174. (fset 'hif-find-ifdef-block #[nil "└è┬yê├ ¼ç─ ¼â┼ ê`╟ ê`S)è┬yê╚ ¼â╔ ê─ ½ê╟ ê╔ ê¬t    `S^ë\n*ç" [nil max-bottom 0 hif-looking-at-else hif-looking-at-ifX up-ifdef top hif-ifdef-to-endif hif-looking-at-endif hif-find-next-relevant bottom] 2 "\
  175. Utilitiy for hide and show ifdef-block.  Set top and bottom of ifdef block."])
  176. (fset 'hide-ifdef-block #[nil "¼ä└┴!ê\n½â├ ê─╞ë╔ ê╩\"ê ½ï╠!ê╠T!ê─*¼ä¡é├ ç" [hide-ifdef-mode 1 buffer-read-only toggle-read-only t selective-display nil bottom top hif-find-ifdef-block hide-ifdef-region hide-ifdef-lines hif-hide-line hide-ifdef-hiding hide-ifdef-read-only hif-outside-read-only] 3 "\
  177. Hide the ifdef block (true or false part) enclosing or before the cursor." nil])
  178. (fset 'show-ifdef-block #[nil "ë½â┬ ê ½Éè─yê┼`S╞ê`\"ê)¬Æ╞ë╔ ê┼S\"ê*    ¡é┬ )ç" [buffer-read-only old-read-only toggle-read-only hide-ifdef-lines 0 hif-show-ifdef-region nil bottom top hif-find-ifdef-block] 4 "\
  179. Show the ifdef block (true or false part) enclosing or before the cursor." nil])
  180. (defvar hide-ifdef-define-alist nil "\
  181. A global assoc list of pre-defined symbol lists")
  182. (fset 'hif-compress-define-list #[(env) "└┴\n\"├ë½Å@½à@ BAë¼q *ç" [mapcar #[(arg) "└    @!¡é    @ç" [hif-lookup arg] 2] env nil new-defs defs] 4 "\
  183. Compress the define list ENV into a list of defined symbols only."])
  184. (fset 'hide-ifdef-set-define-alist #[(name) "┴\n!B Bëç" [name hif-compress-define-list hide-ifdef-env hide-ifdef-define-alist] 3 "\
  185. Set the association for NAME to hide-ifdef-env." "SSet define list: "])
  186. (fset 'hide-ifdef-use-define-alist #[(name) "└    \n\"ë½ë─┼ A\"¬à╟╚    \"ê    ¡é╩ )ç" [assoc name hide-ifdef-define-alist define-list mapcar #[(arg) "┴Bç" [arg t] 2] hide-ifdef-env error "No define list for %s" hide-ifdef-hiding hide-ifdefs] 4 "\
  187. Set hide-ifdef-env to the define list specified by NAME." "SUse define list: "])
  188.